/**
  ******************************************************************************
  * @文件名称 : disp_pro.c
  * @摘要 : 
  * @创建日期 : Sep 7, 2024
  * @创建者：Edward
  ******************************************************************************
  * @使用说明
  *
  *  
  ******************************************************************************
  */

/* 声明包含头文件 -----------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "lvgl.h"
#include "../Inc/data_public.h"
/* 声明私有宏定义 -----------------------------------------------------------*/
#define LIST_BTN_QTY (4)	/* 边栏按键数量 */
#define SENSOR_CALI_SUMQTY (7)  /* 传感器校准总数 */
/* 声明私有类型定义---------------------------------------------------------*/
struct listBtnStr{
	uint16_t isEnable;/* 校准是否使能 */
	char* taitle;/* 显示的标题 */
	void (*tab_create_func)(void);
};
struct autoCreateCaliStr{
	uint16_t isEnable;/* 校准是否使能 */
	char* taitle;/* 显示的标题 */
};
/* 声明私有常量 -------------------------------------------------------------*/

/* 声明私有变量 -------------------------------------------------------------*/
static lv_obj_t* tabCont;			  // 主显示容器
static lv_timer_t * timer_refresh_data;/* 刷新数据的定时器 */
static uint8_t now_tab_ID;	/* 现在的tab ID */
static struct listBtnStr listBtn[LIST_BTN_QTY];/* 侧边栏按键结构体 */
static struct autoCreateCaliStr CaliShow[SENSOR_CALI_SUMQTY];
static ta_userData_t taUser_cali[SENSOR_CALI_SUMQTY][2];
static ta_userData_t taUser_PID[4][3];
static ta_userData_t taUser_offset[3];

/* 声明私有函数 -------------------------------------------------------------*/

/**
  * @brief	定时刷新数据回调函数
  * @param  None
  * @retval None
  */
static void refresh_data_cb(lv_timer_t* timer)
{
	LV_UNUSED(timer);
	/* 遍历所有的文本框，对文本框的内容进行更新 */
	for(uint8_t i = 0; i < lv_obj_get_child_cnt(tabCont); i++)
	{
		lv_obj_t* child = lv_obj_get_child(tabCont, i);
		if(lv_obj_check_type(child, &lv_textarea_class))
		{
			char str[10] = {0};
			ta_userData_t userData = *(ta_userData_t *)lv_obj_get_user_data(child);
			if(type_is_float(userData.type))
				sprintf(str, userData.type, *(float*)userData.data.userData.value);
			else
				sprintf(str, userData.type, *(uint16_t*)userData.data.userData.value);
			lv_textarea_set_text(child, str);
		}
	}
}
/**
  * @brief	侧边栏按键事件回调函数
  * @param  None
  * @retval None
  */
static void btn_tabList_cb(lv_event_t * e)
{
	lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
	lv_obj_t* parent = lv_obj_get_parent(obj);
	if (code == LV_EVENT_CLICKED)
	{
		for (uint32_t i = 0; i < lv_obj_get_child_cnt(parent); i++)
		{
			lv_obj_t* child = lv_obj_get_child(parent, i);
			if (child == obj)
			{
				if(now_tab_ID == i)
					return;
				lv_obj_add_state(child, LV_STATE_CHECKED);
				lv_obj_del(tabCont);
				tabCont = lv_obj_create(parentObj);
				lv_obj_set_size(tabCont, lv_pct(73), lv_pct(90));
				lv_obj_add_style(tabCont, &style_cont1, 0);
				lv_obj_set_scrollbar_mode(tabCont, LV_SCROLLBAR_MODE_OFF); // 设置滚动条模式为永不显示
				lv_obj_align(tabCont, LV_ALIGN_TOP_RIGHT, -8, 24);
				now_tab_ID = i;
				listBtn[now_tab_ID].tab_create_func();
			}
			else
			{
				lv_obj_clear_state(child, LV_STATE_CHECKED);
			}
		}
	}
}
/**
  * @brief	界面中按键事件回调函数
  * @param  None
  * @retval None
  */
static void btn_tab_cb(lv_event_t * e)
{
	lv_event_code_t code = lv_event_get_code(e);
	lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e);
	lv_obj_t* parent = lv_obj_get_parent(obj);
	if (code == LV_EVENT_CLICKED)
	{
		for (uint16_t i = 0; i < lv_obj_get_child_cnt(parent); i++)
		{
			lv_obj_t* child = lv_obj_get_child(parent, i);
			if (child == obj)
			{
				lv_obj_add_state(child, LV_STATE_CHECKED);
				*(uint16_t *)(e->user_data) = i;
			}
			else
			{
				lv_obj_clear_state(child, LV_STATE_CHECKED);
			}
		}
	}
}
/**
  * @brief	传感器校准界面结构体初始化
  * @param  None
  * @retval None
  */
static void tab_sensorCaliStr_init(void)
{
	taUser_cali[0][0].data.userData.value = &UP.CaliTemp1_K;
	taUser_cali[0][0].data.userData.store_enable = 1;
	taUser_cali[0][1].data.userData.value = &UP.CaliTemp1_B;
	taUser_cali[0][1].data.userData.store_enable = 1;
	taUser_cali[1][0].data.userData.value = &UP.CaliTemp2_K;
	taUser_cali[1][0].data.userData.store_enable = 1;
	taUser_cali[1][1].data.userData.value = &UP.CaliTemp2_B;
	taUser_cali[1][1].data.userData.store_enable = 1;
	taUser_cali[2][0].data.userData.value = &UP.CaliTemp3_K;
	taUser_cali[2][0].data.userData.store_enable = 1;
	taUser_cali[2][1].data.userData.value = &UP.CaliTemp3_B;
	taUser_cali[2][1].data.userData.store_enable = 1;
	taUser_cali[3][0].data.userData.value = &UP.CaliFlow_K;
	taUser_cali[3][0].data.userData.store_enable = 1;
	taUser_cali[3][1].data.userData.value = &UP.CaliFlow_B;
	taUser_cali[3][1].data.userData.store_enable = 1;
	taUser_cali[4][0].data.userData.value = &UP.CaliPress_K1;
	taUser_cali[4][0].data.userData.store_enable = 1;
	taUser_cali[4][1].data.userData.value = &UP.CaliPress_B1;
	taUser_cali[4][1].data.userData.store_enable = 1;
	taUser_cali[5][0].data.userData.value = &UP.CaliPress_K2;
	taUser_cali[5][0].data.userData.store_enable = 1;
	taUser_cali[5][1].data.userData.value = &UP.CaliPress_B2;
	taUser_cali[5][1].data.userData.store_enable = 1;
	taUser_cali[6][0].data.userData.value = &UP.CaliDI_K;
	taUser_cali[6][0].data.userData.store_enable = 1;
	taUser_cali[6][1].data.userData.value = &UP.CaliDI_B;
	taUser_cali[6][1].data.userData.store_enable = 1;

	for(uint8_t i = 0; i < SENSOR_CALI_SUMQTY; i++)
	{
		for(uint8_t j = 0; j < 2; j++)
		{
			taUser_cali[i][j].data.min = -999;
			taUser_cali[i][j].data.max = 999;
			taUser_cali[i][j].width = lv_pct(25);
			taUser_cali[i][j].height = lv_pct(10);
			taUser_cali[i][j].max_length = 8;
			taUser_cali[i][j].accepted_chars = "0123456789-.";
			taUser_cali[i][j].one_line = true;
			taUser_cali[i][j].cursor_click_pos = false;
		}
		taUser_cali[i][0].type = "%.3f";
		taUser_cali[i][1].type = "%.2f";
		taUser_cali[i][0].pos_x = lv_pct(40);
		taUser_cali[i][1].pos_x = lv_pct(70);
	}

	/* 主温度传感器 */
	CaliShow[0].isEnable = 1;
	CaliShow[0].taitle = dispText[DA.typeLanguage].mainTemp;
	/* 辅助温度传感器 */
	CaliShow[1].isEnable = FP.ES_Temp2;
	CaliShow[1].taitle = dispText[DA.typeLanguage].auxTemp;
	/* 环境温度传感器 */
	CaliShow[2].isEnable = FP.ES_TempAmbi;
	CaliShow[2].taitle = dispText[DA.typeLanguage].ambTemp;
	/* 出液流量传感器 */
	CaliShow[3].isEnable = FP.ES_Flow;
	CaliShow[3].taitle = dispText[DA.typeLanguage].flow;
	/* 出液压力传感器 */
	CaliShow[4].isEnable = FP.ES_Press_Out;
	CaliShow[4].taitle = dispText[DA.typeLanguage].outletPress;
	/* 回液压力传感器 */
	CaliShow[5].isEnable = FP.ES_Press_In;
	CaliShow[5].taitle = dispText[DA.typeLanguage].returnPress;
	/* 水质传感器 */
	CaliShow[6].isEnable = FP.ES_DI;
	CaliShow[6].taitle = dispText[DA.typeLanguage].criWater;
}
/**
  * @brief	传感器校准界面创建
  * @param  None
  * @retval None
  */
static void tab_sensorCali_create(void)
{
	/* 初始化文本框属性 */
	tab_sensorCaliStr_init();

	/* 遍历所有传感器，将使能的传感器相关的信息创建到界面中 */
	lv_obj_t* label = NULL;
	uint8_t line = 0;
	/* 创建首行标题 */
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "K:");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(50), 0);
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "B:");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(80), 0);
	for(uint8_t cnt = 0; cnt < SENSOR_CALI_SUMQTY; cnt++)
	{
		if(CaliShow[cnt].isEnable)
		{
			/* 创建该行的标题 */
			label = lv_label_create(tabCont);
			lv_label_set_text(label, CaliShow[cnt].taitle);
			lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
			lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(23 * (line + 1)));
			/* 创建该行的K值输入框 */
			taUser_cali[cnt][0].pos_y = lv_pct(23 * (line + 1) - 5);
			textarea_create_by(tabCont, &taUser_cali[cnt][0]);
			/* 创建该行的B值输入框 */
			taUser_cali[cnt][1].pos_y = lv_pct(23 * (line + 1) - 5);
			textarea_create_by(tabCont, &taUser_cali[cnt][1]);
			/* 创建该行完毕，增加到下一行 */
			line++;
		}
	}
}
/**
  * @brief	PID整定界面结构体初始化
  * @param  None
  * @retval None
  */
static void tab_PID_init(void)
{
	taUser_PID[0][0].data.userData.value = &UP.TempPID_P1;
	taUser_PID[0][0].data.userData.store_enable = 1;
	taUser_PID[0][1].data.userData.value = &UP.TempPID_I1;
	taUser_PID[0][1].data.userData.store_enable = 1;
	taUser_PID[0][2].data.userData.value = &UP.TempPID_D1;
	taUser_PID[0][2].data.userData.store_enable = 1;
	taUser_PID[1][0].data.userData.value = &UP.TempPID_P;
	taUser_PID[1][0].data.userData.store_enable = 1;
	taUser_PID[1][1].data.userData.value = &UP.TempPID_I;
	taUser_PID[1][1].data.userData.store_enable = 1;
	taUser_PID[1][2].data.userData.value = &UP.TempPID_D;
	taUser_PID[1][2].data.userData.store_enable = 1;
	taUser_PID[2][0].data.userData.value = &UP.TempPID_P3;
	taUser_PID[2][0].data.userData.store_enable = 1;
	taUser_PID[2][1].data.userData.value = &UP.TempPID_I3;
	taUser_PID[2][1].data.userData.store_enable = 1;
	taUser_PID[2][2].data.userData.value = &UP.TempPID_D3;
	taUser_PID[2][2].data.userData.store_enable = 1;
	taUser_PID[3][0].data.userData.value = &UP.FlowPID_P;
	taUser_PID[3][0].data.userData.store_enable = 1;
	taUser_PID[3][1].data.userData.value = &UP.FlowPID_I;
	taUser_PID[3][1].data.userData.store_enable = 1;
	taUser_PID[3][2].data.userData.value = &UP.FlowPID_D;
	taUser_PID[3][2].data.userData.store_enable = 1;
	for(uint8_t i = 0; i < 4; i++)
	{
		for(uint8_t j = 0; j < 3; j++)
		{
			taUser_PID[i][j].width = lv_pct(20);
			taUser_PID[i][j].height = lv_pct(10);
			taUser_PID[i][j].max_length = 6;
			taUser_PID[i][j].accepted_chars = "0123456789-.";
			taUser_PID[i][j].one_line = true;
			taUser_PID[i][j].cursor_click_pos = false;
		}
		taUser_PID[i][0].data.min = -999;
		taUser_PID[i][0].data.max = 999;
		taUser_PID[i][1].data.min = 0;
		taUser_PID[i][1].data.max = 9999;
		taUser_PID[i][1].width = lv_pct(18);
		taUser_PID[i][2].data.min = 0;
		taUser_PID[i][2].data.max = 999;
		taUser_PID[i][2].width = lv_pct(22);
		taUser_PID[i][0].type = "%.1f";
		taUser_PID[i][1].type = "%.0f";
		taUser_PID[i][2].type = "%.2f";
		taUser_PID[i][0].pos_x = lv_pct(36);
		taUser_PID[i][1].pos_x = lv_pct(58);
		taUser_PID[i][2].pos_x = lv_pct(78);
	}
}
/**
  * @brief	PID整定界面创建
  * @param  None
  * @retval None
  */
static void tab_PID_create(void)
{
	/* PID整定界面结构体初始化 */
	tab_PID_init();

	/* 创建固定文本 */
	lv_obj_t* label = NULL;
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "P:");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(45), 0);
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "I:");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(67), 0);
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "D:");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, lv_pct(87), 0);
	label = lv_label_create(tabCont);
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_label_set_text(label, dispText[DA.typeLanguage].tempTuning);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, 0);
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "SV<5℃");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(22));
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "5℃<SV≤45℃");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(42));
	label = lv_label_create(tabCont);
	lv_label_set_text(label, "45℃<SV");
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(65));
	label = lv_label_create(tabCont);
	lv_label_set_text(label, dispText[DA.typeLanguage].flowTuning);
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(86));

	/* 创建文本框 */
	for(uint8_t i = 0; i < 4; i++)
	{
		for(uint8_t j = 0; j < 3; j++)
		{
			taUser_PID[i][j].pos_y = lv_pct(22 * (i + 1) - 8);
			textarea_create_by(tabCont, &taUser_PID[i][j]);
		}
	}
}
/**
  * @brief	温度补偿界面结构体初始化
  * @param  None
  * @retval None
  */
static void tab_offset_init(void)
{
	if(UP.Type_Compensate == 0)
	{
		taUser_offset[0].data.userData.value = &UP.SV_Compensate;
		taUser_offset[0].data.userData.store_enable  = 1;
	}
	else
	{
		taUser_offset[0].data.userData.value = &UP.SV_AutoCompensate;
		taUser_offset[0].data.userData.store_enable  = 1;
	}

	taUser_offset[1].data.userData.value = &UP.SV_TimeCompensate;
	taUser_offset[1].data.userData.store_enable  = 1;
	taUser_offset[2].data.userData.value = &UP.SV_AccuracyCompensate;
	taUser_offset[2].data.userData.store_enable  = 1;
	for(uint8_t i = 0; i < 3; i++)
	{
		taUser_offset[i].data.min = -999;
		taUser_offset[i].data.max = 999;
		taUser_offset[i].width = lv_pct(18);
		taUser_offset[i].height = lv_pct(10);
		taUser_offset[i].max_length = 6;
		taUser_offset[i].accepted_chars = "0123456789-.";
		taUser_offset[i].one_line = true;
		taUser_offset[i].cursor_click_pos = false;
		taUser_offset[i].pos_x = lv_pct(75);
	}
	taUser_offset[0].type = "%.2f";
	taUser_offset[1].type = "%d";
	taUser_offset[2].type = "%.1f";
	taUser_offset[0].pos_y = lv_pct(23 * (1) - 5);
	taUser_offset[1].pos_y = lv_pct(23 * (2) - 5);
	taUser_offset[2].pos_y = lv_pct(23 * (3) - 5);
}
/**
  * @brief	温度补偿界面创建
  * @param  None
  * @retval None
  */
static void tab_offset_create(void)
{
	/* 温度补偿界面结构体初始化 */
	tab_offset_init();

	/* 创建固定文本 */
	lv_obj_t* label = NULL;
	label = lv_label_create(tabCont);
	lv_label_set_text(label, dispText[DA.typeLanguage].compensMode);
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, 0);
	label = lv_label_create(tabCont);
	lv_label_set_text(label, dispText[DA.typeLanguage].compensTemp);
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(23));
	label = lv_label_create(tabCont);
	lv_label_set_text(label, dispText[DA.typeLanguage].autoCompensText1);
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(46));
	label = lv_label_create(tabCont);
	lv_label_set_text(label, dispText[DA.typeLanguage].autoCompensText2);
	lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_STATE_DEFAULT);
	lv_obj_align(label, LV_ALIGN_TOP_LEFT, 0, lv_pct(69));

	/* 创建按键 */
	lv_obj_t* btnCont = NULL;
	lv_obj_t* btn = NULL;
	btnCont = lv_obj_create(tabCont);
	lv_obj_set_size(btnCont, lv_pct(70), lv_pct(23));
	lv_obj_align(btnCont, LV_ALIGN_TOP_LEFT, lv_pct(30), 0);
	lv_obj_set_style_pad_top(btnCont, 0, LV_STATE_DEFAULT);/* 顶部内填充 */
	lv_obj_set_style_radius(btnCont, 0, LV_STATE_DEFAULT);/* 圆角 */
    lv_obj_set_style_bg_opa(btnCont, LV_OPA_0,LV_STATE_DEFAULT);  //设置背景透明度
    lv_obj_set_style_shadow_opa(btnCont, LV_OPA_0,LV_STATE_DEFAULT);  //设置阴影透明度
//	lv_obj_set_style_border_color(btnCont, lv_palette_main(LV_PALETTE_GREY), LV_STATE_DEFAULT);
//	lv_obj_set_style_border_opa(btnCont, LV_OPA_0, LV_STATE_DEFAULT);
	lv_obj_set_style_border_width(btnCont, 0, LV_STATE_DEFAULT);
	btn = lv_btn_create(btnCont);
	lv_obj_add_style(btn, &style_btn4, LV_STATE_DEFAULT);
	lv_obj_set_style_width(btn, 150, LV_STATE_DEFAULT);
	lv_obj_align(btn, LV_ALIGN_TOP_LEFT, 0, 0);
	label = lv_label_create(btn);
	lv_label_set_text(label, dispText[DA.typeLanguage].manualInput);
	lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
	lv_obj_set_style_bg_color(btn, lv_color_hex(0x3a96f1), LV_STATE_CHECKED);
	lv_obj_add_event_cb(btn, btn_tab_cb, LV_EVENT_CLICKED, &UP.Type_Compensate);
	if(UP.Type_Compensate == 0)
		lv_obj_add_state(btn, LV_STATE_CHECKED);
	btn = lv_btn_create(btnCont);
	lv_obj_add_style(btn, &style_btn4, LV_STATE_DEFAULT);
	lv_obj_set_style_width(btn, 150, LV_STATE_DEFAULT);
	lv_obj_align(btn, LV_ALIGN_TOP_LEFT, lv_pct(50), 0);
	label = lv_label_create(btn);
	lv_label_set_text(label, dispText[DA.typeLanguage].autoCount);
	lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
	lv_obj_set_style_bg_color(btn, lv_color_hex(0x00CC33), LV_STATE_CHECKED);
	lv_obj_add_event_cb(btn, btn_tab_cb, LV_EVENT_CLICKED, &UP.Type_Compensate);
	if(UP.Type_Compensate == 1)
			lv_obj_add_state(btn, LV_STATE_CHECKED);

	for(uint8_t i = 0; i < 3; i++)
	{
		textarea_create_by(tabCont, &taUser_offset[i]);
	}
}
/**
  * @brief	声光设置界面创建
  * @param  None
  * @retval None
  */
static void tab_soundLight_create(void)
{

}
/**
  * @brief	侧边栏按键结构体初始化
  * @param  None
  * @retval None
  */
static void listBtnStr_init(void)
{
	listBtn[0].taitle = dispText[DA.typeLanguage].sensCali;//todo:后面改为传感器校准
	listBtn[0].isEnable = 1;
	listBtn[0].tab_create_func = tab_sensorCali_create;
	listBtn[1].taitle = dispText[DA.typeLanguage].pidTuning;//todo:后面改为PID整定
	listBtn[1].isEnable = 1;
	listBtn[1].tab_create_func = tab_PID_create;
	listBtn[2].taitle = dispText[DA.typeLanguage].autoCompens;//todo:后面改为温度补偿
	listBtn[2].isEnable = 1;
	listBtn[2].tab_create_func = tab_offset_create;
	listBtn[3].taitle = dispText[DA.typeLanguage].VLSet;//todo:后面改为声光设置
	listBtn[3].isEnable = 0;
	listBtn[3].tab_create_func = tab_soundLight_create;
}
/**
  * @brief	共享内容创建
  * @param  None
  * @retval None
  */
static void create_commons(void)
{
	static lv_style_t tab_btn_style;	  // 侧边栏按钮样式
	static lv_style_t tab_bg_style;       // 主容器背景样式
	lv_obj_t* tabList = NULL;			  // 侧边栏容器
	lv_obj_t* tabListBtn = NULL;	/* 侧边栏按键 */
	lv_obj_t* label = NULL;			/* 侧边栏按键上标签 */
	/* 设置侧边栏按钮风格 */
	lv_style_init(&tab_btn_style);
	lv_style_set_bg_color(&tab_btn_style, lv_color_hex(0x7590bd));
	lv_style_set_border_color(&tab_btn_style, lv_color_hex(0x7590bd));
	lv_style_set_border_width(&tab_btn_style, 0);
	/* 设置背景风格 */
	lv_style_init(&tab_bg_style);
	lv_style_set_bg_color(&tab_bg_style, lv_color_hex(0xefefef));
	/* 界面背景 */
	parentObj_img = lv_img_create(lv_scr_act());
    lv_img_set_src(parentObj_img, &dsc_img_buff[2]);
    lv_obj_add_style(parentObj_img, &style_parentObj, LV_STATE_DEFAULT);  //添加父对象为无填充样式
    lv_obj_set_size(parentObj_img, lv_pct(100), lv_pct(100));  //设置父对象的大小
    lv_obj_align(parentObj_img, LV_ALIGN_BOTTOM_MID, 0, 0);  //设置父对象的位置
	/* 界面父对象 */
	parentObj = lv_obj_create(lv_scr_act());
	lv_obj_add_style(parentObj, &style_parentObj, LV_STATE_DEFAULT);
	lv_obj_set_size(parentObj, lv_pct(100), lv_pct(88));
	lv_obj_set_style_bg_color(parentObj,lv_palette_main(LV_PALETTE_GREEN),LV_STATE_DEFAULT);
	lv_obj_align(parentObj, LV_ALIGN_BOTTOM_LEFT, 0, 0);
	/* 添加侧边栏容器 */
	tabList = lv_obj_create(parentObj);
	lv_obj_set_size(tabList, lv_pct(27), lv_pct(90));
	lv_obj_add_style(tabList, &style_list1, 0);
	lv_obj_set_scrollbar_mode(tabList, LV_SCROLLBAR_MODE_OFF); // 设置滚动条模式为永不显示
	lv_obj_align(tabList, LV_ALIGN_TOP_LEFT, 0, 24);
	/* 添加主容器 */
	tabCont = lv_obj_create(parentObj);
	lv_obj_set_size(tabCont, lv_pct(73), lv_pct(90));
	lv_obj_add_style(tabCont, &style_cont1, 0);
	lv_obj_set_scrollbar_mode(tabCont, LV_SCROLLBAR_MODE_OFF); // 设置滚动条模式为永不显示
	lv_obj_align(tabCont, LV_ALIGN_TOP_RIGHT, -8, 24);

	/* 添加按钮到侧边栏 */
	for(uint8_t btnCnt = 0; btnCnt < LIST_BTN_QTY; btnCnt++)
	{
		if(listBtn[btnCnt].isEnable)
		{
			tabListBtn = lv_btn_create(tabList);
			lv_obj_set_size(tabListBtn, 202, 89);
			lv_obj_add_style(tabListBtn, &tab_btn_style, LV_STATE_DEFAULT);
			lv_obj_set_style_bg_color(tabListBtn, lv_color_hex(0x9c9c9c), LV_STATE_DEFAULT);
//			lv_obj_set_style_bg_color(tabListBtn, lv_color_hex(0x1e6fbe), LV_STATE_CHECKED);
			lv_obj_set_style_bg_img_src(tabListBtn, &dsc_ico_buff[3], LV_STATE_DEFAULT);
			lv_obj_set_style_bg_img_src(tabListBtn, &dsc_ico_buff[2], LV_STATE_CHECKED);
			lv_obj_align(tabListBtn, LV_ALIGN_TOP_MID, 0, (btnCnt * 95));
			lv_obj_add_event_cb(tabListBtn, btn_tabList_cb, LV_EVENT_CLICKED, NULL);
			label = lv_label_create(tabListBtn);
			lv_label_set_text(label, listBtn[btnCnt].taitle);
			lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_STATE_DEFAULT);
			lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
		}
	}

	/* 第一个按键默认为按下状态 */
	tabListBtn = lv_obj_get_child(tabList, 0);
	lv_obj_add_state(tabListBtn, LV_STATE_CHECKED);
}
/**
  * @brief	创建高级参数界面
  * @param  None
  * @retval None
  */
void UI_create_pro(void)
{
	/* 侧边栏按键结构体初始化 */
	listBtnStr_init();

	/* 共享内容创建 */
	create_commons();

    /* 初始化默认选项卡一 */
	now_tab_ID = 0;
	listBtn[now_tab_ID].tab_create_func();

	/* 创建一个定时器，定时刷新界面中文本框中的数据 */
	timer_refresh_data = lv_timer_create(refresh_data_cb, 200, NULL);
}

/**
  * @brief	删除高级参数界面
  * @param  None
  * @retval None
  */
void UI_delete_pro(void)
{
	lv_obj_del(parentObj);
	lv_obj_del(parentObj_img);
	lv_timer_del(timer_refresh_data);
}
/**************** (C) COPYRIGHT EdwardYang *************END OF FILE****/


